<?php
namespace Api\Controller;
use Think\Controller;
class ItemController extends Controller {

    /**
     * 道具查询
     */
    public function item_search() {
        $search = I('get.search');
        $order = strtoupper(I('get.order'));
        if (empty($search)) {
            echo json_encode(array(
                'rows'  => []
            ));
            return;
        }

        $sql = "SELECT entry, name_loc4 AS name FROM locales_item WHERE name_loc4 like '%$search%' ORDER BY entry $order;";
        $model = M();
        $model->db(2, "DB_WORLD");
        echo json_encode($model->query($sql));
    }

}